package com.example.administrator.myapplication.Http;



import com.example.administrator.myapplication.Bean.AjaxResult;
import com.example.administrator.myapplication.Bean.DuanziBean;
import com.example.administrator.myapplication.Bean.Label;
import com.example.administrator.myapplication.Bean.Notice;
import com.example.administrator.myapplication.Bean.Picture;
import com.example.administrator.myapplication.Bean.User;

import java.util.HashMap;
import java.util.List;

import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;

/**
 * Created by Administrator on 2019/6/14 0014.
 * 管理APP的HTTP请求
 */

public interface RetrofitService {
   /*
   *  https://api.apiopen.top/getJoke?page=1&count=10&type=image
   * */
    @GET("getJoke")
     Call<DuanziBean> getDuanzi(@Query("page") int page,@Query("count") int count,@Query("type") String img);

    /**
     * User
     * */
    @FormUrlEncoded
    @POST("login")
     Call<AjaxResult>login(@Field("username") String username, @Field("password") String password, @Field("validateCode") String validateCode, @Field("rememberMe") boolean rememberMe);

    @FormUrlEncoded
    @POST("system/user/checkLoginNameUnique")
    Call<ResponseBody>checkLoginNameUnique(@Field("loginName") String loginName);

    @FormUrlEncoded
    @POST("system/user/checkPhoneUnique")
     Call<ResponseBody>checkPhoneUnique(@Field("phonenumber") String phonenumber);

    @FormUrlEncoded
    @POST("system/user/checkEmailUnique")
     Call<ResponseBody>checkEmailUnique(@Field("email") String email);

    @POST("system/user/logon")
     Call<AjaxResult>logon(@Body User user);

    @GET("system/user/profile/app")
     Call<User>getProfile();

   @FormUrlEncoded
   @POST("system/user/profile/update")
    Call<AjaxResult>updateProfile(@Field("loginName")String loginName,@Field("userName")String userName,
                                 @Field("email")String email,@Field("phonenumber")String phonenumber,
                                 @Field("sex")String sex,@Field("password")String password,
                                 @Field("avatar")String avatar,@Field("userId")Long userId);


   @GET("system/picture/random")
    Call<Picture> getRandomPicture();

   @POST("system/label/add")
    Call<AjaxResult> addLabel(@Body Label label);

   @GET("system/label/app/list")
    Call<List<HashMap>> getLabels();

   @POST("system/notice/app/list")
    Call<List<Notice>> getNotices(@Body Notice notice);
}
